const data = [
  {
    name: "flare",
    children: [
      {
        name: "data",
        children: [
          {
            name: "converters",
            children: [
              { name: "Converters", value: 721 },
              { name: "DelimitedTextConverter", value: 4294 },
            ],
          },
          {
            name: "DataUtil",
            value: 3322,
          },
        ],
      },
      {
        name: "display",
        children: [
          { name: "DirtySprite", value: 8833 },
          { name: "LineSprite", value: 1732 },
          { name: "RectSprite", value: 3623 },
        ],
      },
      {
        name: "flex",
        children: [{ name: "FlareVis", value: 4116 }],
      },
      {
        name: "query",
        children: [
          { name: "AggregateExpression", value: 1616 },
          { name: "And", value: 1027 },
          { name: "Arithmetic", value: 3891 },
          { name: "Average", value: 891 },
          {
            name: "methods",
            children: [
              { name: "add", value: 593 },
              { name: "and", value: 330 },
              { name: "average", value: 287 },
              { name: "count", value: 277 },
            ],
          },
          { name: "Minimum", value: 843 },
          { name: "Not", value: 1554 },
          { name: "Or", value: 970 },

          { name: "Xor", value: 1101 },
        ],
      },
      {
        name: "scale",
        children: [
          { name: "IScaleMap", value: 2105 },
          { name: "LinearScale", value: 1316 },
          { name: "LogScale", value: 3151 },
          { name: "ScaleType", value: 1821 },
          { name: "TimeScale", value: 5833 },
        ],
      },
    ],
  },
];

function disposeTreeData(data) {
  data.forEach((item) => {
    item.name = item.name + "用户";
    item.value = item?.value || "0万户";
    item.equalName = "同比";
    item.equalValue = "+18.96万户";
    item.equalPercent = "17.56%";
    item.loopName = "环比";
    item.loopValue = "+56.12万户";
    item.loopPercent = "87.11%";
    if (item.children && item.children?.length > 0) {
      disposeTreeData(item.children);
    }
  });
  return data;
}

export default disposeTreeData(data);
